package com.syslog.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.assessment.entity.AssessmentTemplate;
import com.staff.dao.StaffRepository;
import com.syslog.dao.SyslogRepository;
import com.syslog.entity.Syslog;

@Service
@Transactional
public class SyslogService implements ISyslogService{
	
	@Autowired
	private SyslogRepository syslogRepository;
	public void saveOrUpdate(Syslog syslog) {		
		syslogRepository.save(syslog);
	}
	
	
	public void delete(Long id) {
		Syslog syslog=syslogRepository.findOne(id);
		if(syslog!=null) {			
			syslogRepository.delete(syslog);
		}
	}
	
	public void delete(List<Long> ids) {		
		List<Syslog> syslogList =  (List<Syslog>) syslogRepository.findAll(ids);		
		if(syslogList!=null) {
			syslogRepository.delete(syslogList);
		}		
	}
	
	@Transactional(readOnly = true)
	public Syslog findOne(Long id) {
		
		return syslogRepository.findOne(id);
	}
	
	@Transactional(readOnly = true)
	public List<Syslog> findAll(){
		
		return (List<Syslog>) syslogRepository.findAll();
	}

	@Transactional(readOnly = true)
	public Page<Syslog> findPage(Specification<Syslog> spec, Pageable pageable){
		
		return syslogRepository.findAll(spec, pageable);
	}

}
